#include "file_crypt.h"


int
main (int argc, char *argv[])
{
	if(argc < 3)
		{
			printf("%s [filenameWithPath] [password]\n\n", argv[0]);
			return -1;
		}
		
	char* fileName = argv[1];
	char* key = argv[2]	;
	
    AES_KEY* ekey = malloc( sizeof(AES_KEY) );
    AES_KEY* dkey = malloc( sizeof(AES_KEY) );

    printf("Encryption Key...\n");

    if( AES_set_encrypt_key(key,256,ekey) != 0 )
        printf("Error , Generating the Encrypted Key\n");


    printf("The Generated Key is =  \n");

    int i=0;
    for(i=0 ; i < (AES_MAXNR+1)*4 ; i++)
        printf("%u",ekey->rd_key[i]);

    printf("\n\n");

    printf("Decryption Key...\n");
 
 
    if( AES_set_decrypt_key(key,256,dkey) != 0 )
        printf("Error , Generating the decrypted Key\n");

    for(i=0 ; i < (AES_MAXNR+1)*4 ; i++)
        printf("%u",dkey->rd_key[i]);

    printf("\n\n");
	
	
	
	encryptFile(fileName,"encryptedFile",ekey);
	
	decryptFile("encryptedFile","decryptedFile",dkey);
	
	
	
	return 0;
}
